/*
 * @(#)PatientIdInfo.java
 * Date 2014-01-20
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package com.chrisuyehara.vista.rpc.models;

import java.util.Date;

import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;


/**
 * Class description
 *
 *
 * @version        v1.0, 2014-01-20
 * @author         Jim Horner
 */
public class PatientIdInfo {

    /** Field description */
    private Date dateOfBirth;

    /** Field description */
    private String dfn;

    /** Field description */
    private String firstName;

    /** Field description */
    private String gender;

    /** Field description */
    private String icn;

    /** Field description */
    private String lastName;

    /** Field description */
    private String ssn;

    /**
     * Constructs ...
     *
     */
    public PatientIdInfo() {
        super();
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getDfn() {
        return dfn;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getGender() {
        return gender;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getIcn() {
        return icn;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getSsn() {
        return ssn;
    }

    /**
     * Method description
     *
     *
     * @param dateOfBirth
     */
    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    /**
     * Method description
     *
     *
     * @param dfn
     */
    public void setDfn(String dfn) {
        this.dfn = dfn;
    }

    /**
     * Method description
     *
     *
     * @param firstName
     */
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * Method description
     *
     *
     * @param gender
     */
    public void setGender(String gender) {
        this.gender = gender;
    }

    /**
     * Method description
     *
     *
     * @param icn
     */
    public void setIcn(String icn) {
        this.icn = icn;
    }

    /**
     * Method description
     *
     *
     * @param lastName
     */
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * Method description
     *
     *
     * @param ssn
     */
    public void setSsn(String ssn) {
        this.ssn = ssn;
    }

    /**
     * Method description
     *
     *
     * @param name
     */
    public void splitName(String name) {

        String[] pieces = StringUtils.splitPreserveAllTokens(name, ",");

        if (ArrayUtils.isNotEmpty(pieces) && (pieces.length > 0)) {

            setLastName(pieces[0]);

            if (pieces.length > 1) {

                setFirstName(pieces[1]);
            }
        }

    }
}
